<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
 <script src="js/cookie_util.js"></script>
     <script type="text/javascript">
    	var user_id=getCookie("userId");
		console.log(user_id);
    	if(user_id!=null){//用户ID存在    		
    		$(function (){
    			$.ajax({
					url:"http://localhost:8080/visitor/show.do",
					type:"post",
					data:{},
					dataType:"json",
					success:function(rs){
						if(rs.status==0){
							var vis=rs.data;
							for(var i=0;i<vis.length;i++){
								var id=vis[i].id;
								var v_name=vis[i].v_name;
								var v_time=vis[i].v_time;
								var trs='<tr>';
									trs+='<td>'+v_name+'</td>';
									trs+='<td>'+v_time+'</td>';
									trs+='</tr>';
								var $trs=$(trs);
								$("#visitor").append($trs);
							}
						}else{
							alert("访客信息加载失败");
						}
					},
					error:function(){
						alert("发生异常，请稍后再试");
					}
				})		
				
			})	
				
		}else{//用户ID不存在
			top.location.href="http://localhost:8080/login.html"
		}
    </script>  
</head>
<body>
<form method="post" action="" id="listform">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">最近访客（管理员）</strong> <a href="" style="float:right; display:none;">添加字段</a></div>

    <table class="table table-hover text-center">
      <tr>
        <th>访问用户</th>
        <th>访问时间</th>
      </tr>
      <tbody id="visitor">
        
       </tbody>

    </table>
  </div>
</form>
</body>
</html>